<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>JCSDK Objective-C API Reference for iOS/macOS: JCPush类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">JCSDK Objective-C API Reference for iOS/macOS
   &#160;<span id="projectnumber">2.3.3</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">构造函数</a> &#124;
<a href="#pub-static-methods">类方法</a> &#124;
<a href="interface_j_c_push-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">JCPush类 参考<div class="ingroups"><a class="el" href="group___xE6_x8E_xA8_xE9_x80_x81_xE6_xA8_xA1_xE5_x9D_x97.html">推送模块</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#import &lt;<a class="el" href="_j_c_push_8h_source.html">JCPush.h</a>&gt;</code></p>
<div class="dynheader">
类 JCPush 继承关系图:</div>
<div class="dyncontent">
 <div class="center">
  <img src="interface_j_c_push.png" alt=""/>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
构造函数</h2></td></tr>
<tr class="memitem:a6ba6c8e4dd66c679d62da718d8293f50"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_j_c_push.html#a6ba6c8e4dd66c679d62da718d8293f50">addPushInfo:</a></td></tr>
<tr class="separator:a6ba6c8e4dd66c679d62da718d8293f50"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad9572cb4c9316fabecc65d98ace54e06"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_j_c_push.html#ad9572cb4c9316fabecc65d98ace54e06">addPushTemplate:</a></td></tr>
<tr class="separator:ad9572cb4c9316fabecc65d98ace54e06"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
类方法</h2></td></tr>
<tr class="memitem:a969978dd5a4ca4ea8d6be047a506c910"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interface_j_c_push.html">JCPush</a> *)&#160;</td><td class="memItemRight" valign="bottom">+ <a class="el" href="interface_j_c_push.html#a969978dd5a4ca4ea8d6be047a506c910">create:</a></td></tr>
<tr class="separator:a969978dd5a4ca4ea8d6be047a506c910"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a99d6fc358036d11fd039f4f1667b06c3"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">+ <a class="el" href="interface_j_c_push.html#a99d6fc358036d11fd039f4f1667b06c3">destroy</a></td></tr>
<tr class="separator:a99d6fc358036d11fd039f4f1667b06c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>推送类，其中的接口请在登录成功后调用 </p>
</div><h2 class="groupheader">函数文档</h2>
<a id="a6ba6c8e4dd66c679d62da718d8293f50"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6ba6c8e4dd66c679d62da718d8293f50">&#9670;&nbsp;</a></span>addPushInfo:</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (void) addPushInfo: </td>
          <td></td>
          <td class="paramtype">(<a class="el" href="interface_j_c_push_template.html">JCPushTemplate</a> *)&#160;</td>
          <td class="paramname"><em>info</em></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>添加推送模板，用于服务器将不同类型的推送以不同的内容格式推给客户端</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">info</td><td>推送信息 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ad9572cb4c9316fabecc65d98ace54e06"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad9572cb4c9316fabecc65d98ace54e06">&#9670;&nbsp;</a></span>addPushTemplate:</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (void) addPushTemplate: </td>
          <td></td>
          <td class="paramtype">(NSString *)&#160;</td>
          <td class="paramname"><em>pushTemplate</em></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>添加自定义推送模板，用于服务器将不同类型的推送以不同的内容格式推给客户端，登录成功后调用 </p><dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">pushTemplate</td><td>json格式字符串 包含Token模板，通话模板和消息模板，可以根据需要选择对应的模板进行配置，但是最终的json必须包含Token模板 格式为： { 通话推送模板格式, <a class="el" href="interface_j_c_call.html">JCCall</a> 使用 "Notify.APNS.AppId": "注册推送服务的AppId,需要与您在Juphoon网站上传证书时填入的AppId一致", "Notify.APNS.Invite.ResendCount": "推送内容重发次数，会加1", //例如填5，则会发送6次 "Notify.APNS.Invite.ResendTimeout": "推送通知重发的超时时间，即每次重发的时间间隔，单位为妙", "Notify.APNS.Invite.Expiration": "推送过期时间", "Notify.APNS.Token": "注册推送时苹果下发的设备令牌，需转为16进制字符串" "Notify.APNS.Invite.Payload": { // 推送的内容,必须包含一个aps键 "aps": { "alert": { "loc-args": ["${Caller}"], // ${Caller}表示服务器传入的主叫userId，如果主叫设置了昵称则显示昵称 "loc-key": "${MediaType} call from %@" //${MediaType}表示服务器传入的呼叫类型(视频或音频)，%@将会被 loc-args 中的宏定义替代 }, "sound": "%@" //通知铃声，值为APP资源文件内或者Library/Sounds文件夹内的铃声文件名,如果文件不能被找到或者设置了默认值，则会使用系统默认铃声 }, "callid": "${CallId}", // ${CallId}表示服务器生成的callid "resend": "${ResendIndex}" //${ResendIndex}表示服务器返回的第几次重发 }, //Payload可灵活配置，具体参考官网，https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW1</td></tr>
  </table>
  </dd>
</dl>
<p>文本类消息推送模板格式 <a class="el" href="interface_j_c_message_channel.html">JCMessageChannel</a> 使用 "Notify.APNS.Message.Info.text.Expiration": "推送消息过期时间", // text 为 sendMessage 中传入的 type "Notify.APNS.Message.Info.text.Payload":{ // 推送的内容,必须包含一个aps键 "aps": { "alert": { "loc-key": "收到来自%@的消息: %@", // %@将会被 loc-args 中的宏定义替代 "loc-args": ["${Sender}", "${Text}"] //${Sender}表示服务器传入的消息发送者，${Text}表示消息的内容 }, "badge": 1, // 代表app图标右上角的消息数，如果不包含这个key值，消息数量不会改变，如果要删掉这个 badge，则把对应的key值设为0即可</p>
<p>"sound": "default" // 当推送信息送达时手机播放的声音，传defalut就标明使用系统默认声音 }, "to": "${Receiver}" //${Receiver}表示服务器传入的消息接收对象 } }</p>
<p>例如： { "Notify.APNS.AppId": "com.juphoon.cloud.JCSample", // APNS生产环境 "Notify.APNS.AppId": "com.juphoon.cloud.JCSample.DEBUG", // APNS沙盒环境 "Notify.APNS.AppId": "com.juphoon.cloud.JCSample.VOIP", // VOIP 生产环境 "Notify.APNS.AppId": "com.juphoon.cloud.JCSample.VOIP.DEBUG", // VOIP 沙盒环境 "Notify.APNS.Token": "640652DF9891C3CDD7AB30086697713233AAA72F74924A36FAC3C1E60B30AF16", "Notify.APNS.Invite.ResendCount": "3", "Notify.APNS.Invite.ResendTimeout": "3", "Notify.APNS.Invite.Expiration": "3", "Notify.APNS.Invite.Payload": { "aps": { "alert": { "loc-args": ["${Caller}", "${MediaType}"], "loc-key": "收到%@的%@来电" }, "sound": "default" }, "callid": "${CallId}", "resend": "${ResendIndex}" }, "Notify.APNS.Message.Info.text.Expiration": "20", "Notify.APNS.Message.Info.text.Payload": { "aps": { "alert": { "loc-key": "收到来自%@的消息: %@", "loc-args": ["${Sender}", "${Text}"] }, "badge": 1, "sound": "default" }, "to": "${Receiver}" } } </p>

</div>
</div>
<a id="a969978dd5a4ca4ea8d6be047a506c910"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a969978dd5a4ca4ea8d6be047a506c910">&#9670;&nbsp;</a></span>create:</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">+ (<a class="el" href="interface_j_c_push.html">JCPush</a>*) create: </td>
          <td></td>
          <td class="paramtype">(<a class="el" href="interface_j_c_client.html">JCClient</a> *)&#160;</td>
          <td class="paramname"><em>client</em></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>创建 <a class="el" href="interface_j_c_push.html">JCPush</a> 对象</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">client</td><td><a class="el" href="interface_j_c_client.html">JCClient</a> 对象 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回 <a class="el" href="interface_j_c_push.html">JCPush</a> 对象 </dd></dl>

</div>
</div>
<a id="a99d6fc358036d11fd039f4f1667b06c3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a99d6fc358036d11fd039f4f1667b06c3">&#9670;&nbsp;</a></span>destroy</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">+ (void) destroy </td>
          <td></td>
          <td class="paramname"></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>销毁 <a class="el" href="interface_j_c_push.html">JCPush</a> 对象 </p>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>JCSDKOC/JCSDKOC/JCPush/<a class="el" href="_j_c_push_8h_source.html">JCPush.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.20
</small></address>
</body>
</html>
